<template>
  <div>
    <div class="d1">
      <p>小红的年龄：{{state.age}}</p>
      <button @click="add">过年了</button>
    </div>
    <div class="d1">
      <p>小红爸爸的年龄：{{ageFather}}</p>
    </div>
  </div>
</template>

<script setup>
import { reactive, computed } from 'vue';
const state = reactive({
  age: 1
})
let add = () => {
  state.age++
}

// const total = computed({
//   get: () => price.value * 2,
//   set: (value) => {
//     price.value = value / 2;
//   }
// });

//计算数据
let ageFather = computed(() => {
  return state.age + 25
})

</script>
<style scoped lang ='less'>
.d1 {
  margin-top: 20px;
}
</style>